// @ts-ignore
/* eslint-disable */
import { requestAuth } from '@/utils/request';

/** 页面设计新增或修改 */
export async function updateDesignPage(data: {
  pageId: string;
  pageContent: string;
  pageName: string;
  pageDescription: string;
  status: string;
}) {
  return requestAuth({
    method: 'POST',
    url: '/api/system/pageInfo/saveOrUpdate',
    data,
  });
}

/** 获取设计页面列表 */
export async function fetchDesignPageList(data: {
  size: number;
  current: number;
  params?: {
    column: string;
    type: string;
    values?: string;
  }[];
}) {
  return requestAuth({
    method: 'POST',
    url: '/api/system/pageInfo/page',
    data,
  });
}

/** 获取设计页面详情 */
export async function fetchDesignPageDetail(data: { pageId: string }) {
  return requestAuth({
    method: 'POST',
    url: '/api/system/pageInfo/getPageContent',
    data,
  });
}

/** 删除设计页面 */
export async function deletePageDesign(data: { pageId: string }) {
  return requestAuth({
    method: 'POST',
    url: '/api/system/pageInfo/delete',
    data,
  });
}

/** 设计页面状态修改(在页面成功激活或失活后) */
export async function updatePageDesign(data: { pageId: string; status: string }) {
  return requestAuth({
    method: 'POST',
    url: '/api/system/pageInfo/updateStatus',
    data,
  });
}

/** 公共设计模块：Pro-Table的接口请求 */
export async function fetchListByDesignProTable(
  url,
  data: {
    size: number;
    current: number;
    params?: {
      column: string;
      type: string;
      values?: string;
    }[];
  },
) {
  return requestAuth({
    method: 'POST',
    url: `/api${url}`,
    data,
  });
}
